/*
 * Copyright (C) 2010 M. Hautle.
 * 
 * This file is part of SimpleEL.
 * 
 * SimpleEL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * SimpleEL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with SimpleEL. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.simpleel.speed;

import ch.simpleel.data.*;

/**
 * Speed test with native calls
 * 
 * @author M. Hautle
 */
public class Native extends Common {
    /**
     * VM Args:<br>
     * 
     * <pre>
     * -server / -client
     * -Xms512m -Xmx512m
     * -XX:+PrintCompilation 
     * -verbose:gc
     * </pre>
     * 
     * @param args
     */
    public static void main(String[] args) {
        new Native().executeBenchmark();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected boolean executeChecks(TheDom dom, AOtherDom dom2) {
        return checkProperties(dom2) && checkProperties(dom);
    }

    private boolean checkProperties(TheDom d) {
        boolean res = true;
        res &= d.getCity().equals("Bern");
        res &= d.getCountry().equals("Switzerland");
        res &= d.getFirstname().equals("Bob");
        res &= d.getName().equals("Baumeister");
        res &= d.getState().equals("-");
        res &= d.getStreet().equals("Eigerplatz");
        res &= d.getStreetNumber().equals("8");
        res &= d.getZip().equals("3000");
        return res;
    }

    private boolean checkProperties(AOtherDom d) {
        boolean res = true;
        res &= d.getCity().equals("Bern");
        res &= d.getCountry().equals("Switzerland");
        res &= d.getFirstname().equals("Bob");
        res &= d.getName().equals("Baumeister");
        res &= d.getState().equals("-");
        res &= d.getStreet().equals("Eigerplatz");
        res &= d.getStreetNumber().equals("8");
        res &= d.getZip().equals("3000");
        return res;
    }
}
